<template>
  <div class="box">
    <div v-for="(item, i) in data" :key="i" class="item" :style="{ 'background-color': randomColor() }">
      <router-link :to="item.url">{{ item.title }}</router-link>
      第一次test1
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      data: [
        {
          title: '监控摄像头',
          url: '/camera'
        },
        {
          title: '导入导出excel表',
          url: '/excel'
        },
        {
          title: '百度地图',
          url: '/map'
        },
        {
          title: '数据转换',
          url: '/data'
        },
        {
          title: '弹幕',
          url: '/barragePage'
        }
      ]
    }
  },
  methods: {
    randomColor() {
      var str = '#'
      var arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f']
      for (var i = 0; i < 6; i++) {
        var num = parseInt(Math.random() * 16)
        str += arr[num]
      }
      return str
    }
  }
}
</script>
<style lang="less" scoped>
.box {
  display: flex;
}
.item {
  width: 12%;
  height: 50px;
  line-height: 50px;
  text-align: center;
  color: white;
  margin-left: 20px;
  border-radius: 10px;
  box-shadow: 2px 2px 6px black;
}
a {
  text-decoration: none;
  color: white;
}
</style>
